Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Bitcoin source support #931

Merged
merged 1 commit into from
Apr 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
* Adding Masterpass support to `STPSourceParams` [#928](https://github.com/stripe/stripe-ios/pull/928)
* Added community submitted Norwegian (nb) translation. Thank @Nailer!
* Fixed example app usage of localization files (they were not able to be tested in Finnish and Norwegian before)
* Remove Bitcoin source support. See MIGRATING.md. [#931](https://github.com/stripe/stripe-ios/pull/931)
* Add Masterpass support to `STPSourceParams` [#928](https://github.com/stripe/stripe-ios/pull/928)
* Add community submitted Norwegian (nb) translation. Thank @Nailer!
* Fix example app usage of localization files (they were not able to be tested in Finnish and Norwegian before)
* Silence STPAddress deprecation warnings we ignore to stay compatible with older iOS versions
* Fix "Card IO" link in full SDK reference https://github.com/stripe/stripe-ios/pull/913

Expand Down
5 changes: 5 additions & 0 deletions MIGRATING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## Migration Guides

### Migrating from versions < 13.0.0
* Remove Bitcoin source support because Stripe no longer processes Bitcoin payments: https://stripe.com/blog/ending-bitcoin-support
* Sources can no longer have a "STPSourceTypeBitcoin" source type. These sources will now be interpreted as "STPSourceTypeUnknown".
* You can no longer `createBitcoinParams`. Please use a different payment method.

### Migrating from versions < 12.0.0
* The SDK now requires iOS 9+ and Xcode version 9+. If you need to support iOS 8 or Xcode 8, the last supported version is [11.5.0](https://github.com/stripe/stripe-ios/releases/tag/v11.5.0)
* `STPPaymentConfiguration.requiredShippingAddress` now is a set of `STPContactField` objects instead of a `PKAddressField` bitmask.
Expand Down
2 changes: 0 additions & 2 deletions Stripe.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,6 @@
8BCB6E612053389800629978 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 8BCB6E552053389800629978 /* [email protected] */; };
8BD213371F044B57007F6FD1 /* BankAccount.json in Resources */ = {isa = PBXBuildFile; fileRef = 8BD213361F044B57007F6FD1 /* BankAccount.json */; };
8BD213391F0457A1007F6FD1 /* FileUpload.json in Resources */ = {isa = PBXBuildFile; fileRef = 8BD213381F0457A1007F6FD1 /* FileUpload.json */; };
8BD2133C1F0458F5007F6FD1 /* BitcoinSource.json in Resources */ = {isa = PBXBuildFile; fileRef = 8BD2133B1F0458F5007F6FD1 /* BitcoinSource.json */; };
8BD2133E1F045D31007F6FD1 /* SEPADebitSource.json in Resources */ = {isa = PBXBuildFile; fileRef = 8BD2133D1F045D31007F6FD1 /* SEPADebitSource.json */; };
8BD87B881EFB131700269C2B /* STPSourceCardDetails+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BD87B871EFB131400269C2B /* STPSourceCardDetails+Private.h */; };
8BD87B891EFB131800269C2B /* STPSourceCardDetails+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BD87B871EFB131400269C2B /* STPSourceCardDetails+Private.h */; };
Expand Down Expand Up @@ -2514,7 +2513,6 @@
C1CFCB7A1ED5F88D00BE45DF /* stp_test_upload_image.jpeg in Resources */,
F152322F1EA9344600D65C67 /* iDEALSource.json in Resources */,
F16AA26F1F5A0F1700207FFF /* AlipaySource.json in Resources */,
8BD2133C1F0458F5007F6FD1 /* BitcoinSource.json in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
5 changes: 0 additions & 5 deletions Stripe/PublicHeaders/STPSourceEnums.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,6 @@ typedef NS_ENUM(NSInteger, STPSourceType) {
*/
STPSourceTypeBancontact,

/**
A Bitcoin source. @see https://stripe.com/docs/sources/bitcoin
*/
STPSourceTypeBitcoin,

/**
A card source. @see https://stripe.com/docs/sources/cards
*/
Expand Down
14 changes: 0 additions & 14 deletions Stripe/PublicHeaders/STPSourceParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,20 +109,6 @@ NS_ASSUME_NONNULL_BEGIN
returnURL:(NSString *)returnURL
statementDescriptor:(nullable NSString *)statementDescriptor;

/**
Creates params for a Bitcoin source.
@see https://stripe.com/docs/bitcoin#creating-and-displaying-a-source-object

@param amount The amount to charge the customer.
@param currency The currency the payment is being created in.
@param email The customer's email address.

@return an STPSourceParams object populated with the provided values.
*/
+ (STPSourceParams *)bitcoinParamsWithAmount:(NSUInteger)amount
currency:(NSString *)currency
email:(NSString *)email;

/**
Creates params for a Card source.
@see https://stripe.com/docs/sources/cards#create-source
Expand Down
1 change: 0 additions & 1 deletion Stripe/STPSource.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ @implementation STPSource
+ (NSDictionary<NSString *,NSNumber *> *)stringToTypeMapping {
return @{
@"bancontact": @(STPSourceTypeBancontact),
@"bitcoin": @(STPSourceTypeBitcoin),
@"card": @(STPSourceTypeCard),
@"giropay": @(STPSourceTypeGiropay),
@"ideal": @(STPSourceTypeIDEAL),
Expand Down
11 changes: 0 additions & 11 deletions Stripe/STPSourceParams.m
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,6 @@ + (STPSourceParams *)bancontactParamsWithAmount:(NSUInteger)amount
return params;
}

+ (STPSourceParams *)bitcoinParamsWithAmount:(NSUInteger)amount
currency:(NSString *)currency
email:(NSString *)email {
STPSourceParams *params = [self new];
params.type = STPSourceTypeBitcoin;
params.amount = @(amount);
params.currency = currency;
params.owner = @{ @"email": email };
return params;
}

+ (STPSourceParams *)cardParamsWithCard:(STPCardParams *)card {
STPSourceParams *params = [self new];
params.type = STPSourceTypeCard;
Expand Down
38 changes: 30 additions & 8 deletions Tests/Tests/3DSSource.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,36 @@
"livemode": false,
"metadata": {},
"owner": {
"address": null,
"email": null,
"name": null,
"phone": null,
"verified_address": null,
"verified_email": null,
"verified_name": null,
"verified_phone": null
"address": {
"city": "Pittsburgh",
"country": "US",
"line1": "123 Fake St",
"line2": "Apt 1",
"postal_code": "19219",
"state": "PA"
},
"email": "[email protected]",
"name": "Jenny Rosen",
"phone": "555-867-5309",
"verified_address": {
"city": "Pittsburgh",
"country": "US",
"line1": "123 Fake St",
"line2": "Apt 1",
"postal_code": "19219",
"state": "PA"
},
"verified_email": "[email protected]",
"verified_name": "Jenny Rosen",
"verified_phone": "555-867-5309"
},
"receiver": {
"address": "test_1MBhWS3uv4ynCfQXF3xQjJkzFPukr4K56N",
"amount_charged": 300,
"amount_received": 200,
"amount_returned": 100,
"refund_attributes_method": "email",
"refund_attributes_status": "missing"
},
"redirect": {
"return_url": "exampleappschema://stripe_callback",
Expand Down
57 changes: 0 additions & 57 deletions Tests/Tests/BitcoinSource.json

This file was deleted.

9 changes: 3 additions & 6 deletions Tests/Tests/STPCustomerSourceTupleTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ - (void)testSourceTupleCreationInvalidSourcesOnly {
STPCustomer *customer = [STPFixtures customerWithSourcesFromJSONKeys:@[STPTestJSONSource3DS,
STPTestJSONSourceAlipay,
STPTestJSONSourceiDEAL,
STPTestJSONSourceSEPADebit,
STPTestJSONSourceBitcoin]
STPTestJSONSourceSEPADebit]
defaultSource:STPTestJSONSourceiDEAL];
[self performSourceTupleTestWithCustomer:customer
expectedValidSources:0
Expand All @@ -123,8 +122,7 @@ - (void)testSourceTupleCreationMixedValidAndInvalidSourcesWithInvalidDefaultSour
STPTestJSONSourceCard,
STPTestJSONSourceiDEAL,
STPTestJSONSourceSEPADebit,
STPTestJSONCard,
STPTestJSONSourceBitcoin]
STPTestJSONCard]
defaultSource:STPTestJSONSourceiDEAL];

[self performSourceTupleTestWithCustomer:customer
Expand All @@ -138,8 +136,7 @@ - (void)testSourceTupleCreationMixedValidAndInvalidSourcesWithValidDefaultSource
STPTestJSONSourceCard,
STPTestJSONSourceiDEAL,
STPTestJSONSourceSEPADebit,
STPTestJSONCard,
STPTestJSONSourceBitcoin]
STPTestJSONCard]
defaultSource:STPTestJSONCard];
[self performSourceTupleTestWithCustomer:customer
expectedValidSources:2
Expand Down
1 change: 0 additions & 1 deletion Tests/Tests/STPFixtures.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ extern NSString *const STPTestJSONCustomer;
extern NSString *const STPTestJSONCard;

extern NSString *const STPTestJSONSourceAlipay;
extern NSString *const STPTestJSONSourceBitcoin;
extern NSString *const STPTestJSONSourceCard;
extern NSString *const STPTestJSONSource3DS;
extern NSString *const STPTestJSONSourceiDEAL;
Expand Down
1 change: 0 additions & 1 deletion Tests/Tests/STPFixtures.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
NSString *const STPTestJSONCard = @"Card";

NSString *const STPTestJSONSourceAlipay = @"AlipaySource";
NSString *const STPTestJSONSourceBitcoin = @"BitcoinSource";
NSString *const STPTestJSONSourceCard = @"CardSource";
NSString *const STPTestJSONSource3DS = @"3DSSource";
NSString *const STPTestJSONSourceiDEAL = @"iDEALSource";
Expand Down
27 changes: 0 additions & 27 deletions Tests/Tests/STPSourceFunctionalTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,33 +48,6 @@ - (void)testCreateSource_bancontact {
[self waitForExpectationsWithTimeout:5.0f handler:nil];
}

- (void)testCreateSource_bitcoin {
STPSourceParams *params = [STPSourceParams bitcoinParamsWithAmount:1000
currency:@"usd"
email:@"[email protected]"];
params.metadata = @{@"foo": @"bar"};

STPAPIClient *client = [[STPAPIClient alloc] initWithPublishableKey:apiKey];
XCTestExpectation *expectation = [self expectationWithDescription:@"Source creation"];
[client createSourceWithParams:params completion:^(STPSource *source, NSError * error) {
XCTAssertNil(error);
XCTAssertNotNil(source);
XCTAssertEqual(source.type, STPSourceTypeBitcoin);
XCTAssertEqualObjects(source.amount, params.amount);
XCTAssertEqualObjects(source.currency, params.currency);
XCTAssertEqualObjects(source.owner.email, params.owner[@"email"]);
XCTAssertEqualObjects(source.metadata, params.metadata);
XCTAssertNotNil(source.receiver);
XCTAssertNotNil(source.receiver.address);
XCTAssertNotNil(source.receiver.amountCharged);
XCTAssertNotNil(source.receiver.amountReceived);
XCTAssertNotNil(source.receiver.amountReturned);

[expectation fulfill];
}];
[self waitForExpectationsWithTimeout:5.0f handler:nil];
}

- (void)testCreateSource_card {
STPCardParams *card = [[STPCardParams alloc] init];
card.number = @"4242 4242 4242 4242";
Expand Down
7 changes: 4 additions & 3 deletions Tests/Tests/STPSourceOwnerTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#import "STPSourceOwner.h"
#import "STPAddress.h"

#import "STPFixtures.h"
#import "STPTestUtils.h"

@interface STPSourceOwnerTest : XCTestCase
Expand All @@ -25,17 +26,17 @@ - (void)testDecodedObjectFromAPIResponseRequiredFields {
NSArray<NSString *> *requiredFields = @[];

for (NSString *field in requiredFields) {
NSMutableDictionary *response = [[STPTestUtils jsonNamed:@"BitcoinSource"][@"owner"] mutableCopy];
NSMutableDictionary *response = [[STPTestUtils jsonNamed:STPTestJSONSource3DS][@"owner"] mutableCopy];
[response removeObjectForKey:field];

XCTAssertNil([STPSourceOwner decodedObjectFromAPIResponse:response]);
}

XCTAssert([STPSourceOwner decodedObjectFromAPIResponse:[STPTestUtils jsonNamed:@"BitcoinSource"][@"owner"]]);
XCTAssert([STPSourceOwner decodedObjectFromAPIResponse:[STPTestUtils jsonNamed:STPTestJSONSource3DS][@"owner"]]);
}

- (void)testDecodedObjectFromAPIResponseMapping {
NSDictionary *response = [STPTestUtils jsonNamed:@"BitcoinSource"][@"owner"];
NSDictionary *response = [STPTestUtils jsonNamed:STPTestJSONSource3DS][@"owner"];
STPSourceOwner *owner = [STPSourceOwner decodedObjectFromAPIResponse:response];

XCTAssertEqualObjects(owner.address.city, @"Pittsburgh");
Expand Down
6 changes: 0 additions & 6 deletions Tests/Tests/STPSourceParamsTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ - (void)testType {
sourceParams.rawTypeString = @"bancontact";
XCTAssertEqual(sourceParams.type, STPSourceTypeBancontact);

sourceParams.rawTypeString = @"bitcoin";
XCTAssertEqual(sourceParams.type, STPSourceTypeBitcoin);

sourceParams.rawTypeString = @"card";
XCTAssertEqual(sourceParams.type, STPSourceTypeCard);

Expand Down Expand Up @@ -85,9 +82,6 @@ - (void)testSetType {
sourceParams.type = STPSourceTypeBancontact;
XCTAssertEqualObjects(sourceParams.rawTypeString, @"bancontact");

sourceParams.type = STPSourceTypeBitcoin;
XCTAssertEqualObjects(sourceParams.rawTypeString, @"bitcoin");

sourceParams.type = STPSourceTypeCard;
XCTAssertEqualObjects(sourceParams.rawTypeString, @"card");

Expand Down
9 changes: 5 additions & 4 deletions Tests/Tests/STPSourceReceiverTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#import "STPSourceReceiver.h"

#import "STPFixtures.h"
#import "STPTestUtils.h"

@interface STPSourceReceiverTest : XCTestCase
Expand All @@ -21,7 +22,7 @@ @implementation STPSourceReceiverTest
#pragma mark - Description Tests

- (void)testDescription {
STPSourceReceiver *receiver = [STPSourceReceiver decodedObjectFromAPIResponse:[STPTestUtils jsonNamed:@"BitcoinSource"][@"receiver"]];
STPSourceReceiver *receiver = [STPSourceReceiver decodedObjectFromAPIResponse:[STPTestUtils jsonNamed:STPTestJSONSource3DS][@"receiver"]];
XCTAssert(receiver.description);
}

Expand All @@ -33,17 +34,17 @@ - (void)testDecodedObjectFromAPIResponseRequiredFields {
];

for (NSString *field in requiredFields) {
NSMutableDictionary *response = [[STPTestUtils jsonNamed:@"BitcoinSource"][@"receiver"] mutableCopy];
NSMutableDictionary *response = [[STPTestUtils jsonNamed:STPTestJSONSource3DS][@"receiver"] mutableCopy];
[response removeObjectForKey:field];

XCTAssertNil([STPSourceReceiver decodedObjectFromAPIResponse:response]);
}

XCTAssert([STPSourceReceiver decodedObjectFromAPIResponse:[STPTestUtils jsonNamed:@"BitcoinSource"][@"receiver"]]);
XCTAssert([STPSourceReceiver decodedObjectFromAPIResponse:[STPTestUtils jsonNamed:STPTestJSONSource3DS][@"receiver"]]);
}

- (void)testDecodedObjectFromAPIResponseMapping {
NSDictionary *response = [STPTestUtils jsonNamed:@"BitcoinSource"][@"receiver"];
NSDictionary *response = [STPTestUtils jsonNamed:STPTestJSONSource3DS][@"receiver"];
STPSourceReceiver *receiver = [STPSourceReceiver decodedObjectFromAPIResponse:response];

XCTAssertEqualObjects(receiver.address, @"test_1MBhWS3uv4ynCfQXF3xQjJkzFPukr4K56N");
Expand Down
Loading