Skip to content

Commit

Permalink
Initial Release
Browse files Browse the repository at this point in the history
  • Loading branch information
ibrahimlawal committed Mar 3, 2016
0 parents commit 81bdd72
Show file tree
Hide file tree
Showing 201 changed files with 14,269 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .clang-format
@@ -0,0 +1,58 @@
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -2
ConstructorInitializerIndentWidth: 4
AlignEscapedNewlinesLeft: false
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AlwaysBreakTemplateDeclarations: false
AlwaysBreakBeforeMultilineStrings: false
BreakBeforeBinaryOperators: false
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: false
BreakConstructorInitializersBeforeComma: false
BinPackParameters: false
BinPackParameters: false
ColumnLimit: 160
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: true
DisableFormat: false
ExperimentalAutoDetectBinPacking: true
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IndentCaseLabels: false
IndentWidth: 4
IndentWrappedFunctionNames: false
IndentFunctionDeclarationAfterType: false
MaxEmptyLinesToKeep: 1
KeepEmptyLinesAtTheStartOfBlocks: false
NamespaceIndentation: None
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: false
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakString: 1000
PenaltyBreakFirstLessLess: 120
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpacesInAngles: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpaceInEmptyParentheses: false
SpacesInParentheses: false
SpacesBeforeTrailingComments: 1
Standard: Cpp11
TabWidth: 8
UseTab: Never
...

25 changes: 25 additions & 0 deletions .github/CONTRIBUTING.md
@@ -0,0 +1,25 @@
# Contributing

Contributions are **welcome** and will be fully **credited**.

We accept contributions via Pull Requests.


## Pull Requests

- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.

- **Create feature branches** - Don't ask us to pull from your master branch.

- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.

- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.


## Running Tests

TODO: Include Code for runnning tests in this project
``` bash
```

**Happy coding**!
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE.md
@@ -0,0 +1,21 @@
# Problem/Motivation
(Why the issue was filed, steps to reproduce the problem, etc.)

## Proposed resolution
(Description of the proposed solution, the rationale behind it, and workarounds for people who cannot use the patch.)

## Repeatable
Always|Sometimes|Specific conditions|Specific times

(If it is a bug, you are reporting lease specify:)

## Steps to repeat: (Describe how the issue can be repeated by someone who is to work on it)
1. Step 1
2. Step 2
3. ...

## Expected Results:
(What you expected steps 1, 2 and 3 to give)

## Actual Results:
(What is gave including any error messages, memory dump etc that can help)
7 changes: 7 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,7 @@
Fixes #0 (Enter the number for the issue this fixes. If you have not yet created an issue, please do so now or delete this line if you are only submitting a patch)

## Changes made by this pull request
-
-
-

27 changes: 27 additions & 0 deletions .gitignore
@@ -0,0 +1,27 @@
build/*
Tests/build/*
Tests/installation_tests/cocoapods/**/Podfile.lock
Tests/installation_tests/cocoapods/**/Pods
Tests/installation_tests/manual_installation/build
Tests/installation_tests/manual_installation/ManualInstallationTest/Frameworks/Paystack.framework
Tests/installation_tests/carthage/Cartfile
Tests/installation_tests/carthage/Cartfile.resolved
Tests/installation_tests/carthage/Carthage/*

*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
*.swp
*.moved-aside
*.xcscmblueprint
.idea

.DS_Store
profile
DerivedData

xcuserdata

project.xcworkspace

25 changes: 25 additions & 0 deletions .travis.yml
@@ -0,0 +1,25 @@
language: objective-c
osx_image: xcode7

env:
global:
secure: gZMOaHQIeG7nplBCuH7EKf9o6Ez2rtoSskrv3nOTziSxFfZq322MrxvkidDpEN7AKWYQm27FO+tCzgq0slXb578lQ9P5ySDwEdExKtk/jMtKsBsf3cr4dzSMiqV5D5TbsH2jE9HQlpYUoJeoMBicR2XsTmd7wiu2jAzNBFqGfiY=

before_install:
- brew install carthage
- gem update cocoapods --no-ri --no-rdoc
- gem install xcpretty --no-ri --no-rdoc
- ./ci_scripts/install_fauxpas.sh

script:
- "./ci_scripts/check_fauxpas.sh"
- "./ci_scripts/check_version.rb"
- set -o pipefail && xcodebuild test -workspace Paystack.xcworkspace -scheme "PaystackiOS Tests" -configuration Debug -sdk iphonesimulator | xcpretty -c
- set -o pipefail && xcodebuild test -workspace Paystack.xcworkspace -scheme "Paystack iOS Application Tests" -configuration Debug -sdk iphonesimulator -destination "OS=9.0,name=iPhone 6" | xcpretty -c
- set -o pipefail && xcodebuild test -workspace Paystack.xcworkspace -scheme "PaystackOSX Tests" | xcpretty -c
- set -o pipefail && xcodebuild build -workspace Paystack.xcworkspace -scheme "Paystack iOS Example (Simple)" -sdk iphonesimulator | xcpretty -c
- set -o pipefail && xcodebuild build -workspace Paystack.xcworkspace -scheme "Paystack iOS Example (Custom)" -sdk iphonesimulator | xcpretty -c
- "./Tests/installation_tests/cocoapods/with_frameworks/test.sh"
- "./Tests/installation_tests/cocoapods/without_frameworks/test.sh"
- "./Tests/installation_tests/manual_installation/test.sh"
# - "./Tests/installation_tests/carthage/test.sh"
5 changes: 5 additions & 0 deletions CHANGELOG
@@ -0,0 +1,5 @@
=== 1.0.0 2016-03-03

* Initial release

Special thanks to: the Stripe iOS team. This was built based on their library at http://github.com/stripe/stripe-ios .
Binary file added Example/Default-568h@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions Example/Paystack iOS Application Tests/Info.plist
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
@@ -0,0 +1,115 @@
//
// PSTCKPaymentCardTextFieldUITests.m
// Paystack iOS Example
//
//

#import <XCTest/XCTest.h>
#import <Paystack/Paystack.h>

@interface PSTCKPaymentCardTextField (Testing)
@property(nonatomic, readwrite, weak)UIImageView *brandImageView;
@property(nonatomic, readwrite, weak)UITextField *numberField;
@property(nonatomic, readwrite, weak)UITextField *expirationField;
@property(nonatomic, readwrite, weak)UITextField *cvcField;
@property(nonatomic, assign)BOOL numberFieldShrunk;
+ (UIImage *)cvcImageForCardBrand:(PSTCKCardBrand)cardBrand;
+ (UIImage *)brandImageForCardBrand:(PSTCKCardBrand)cardBrand;
@end

@interface PSTCKPaymentCardTextFieldUITests : XCTestCase
@property (nonatomic, strong) PSTCKPaymentCardTextField *sut;
@property (nonatomic, strong) UIViewController *viewController;
@end

@implementation PSTCKPaymentCardTextFieldUITests

- (void)setUp {
[super setUp];
self.viewController = [UIViewController new];
self.sut = [PSTCKPaymentCardTextField new];
[self.viewController.view addSubview:self.sut];
UIWindow *window = [[UIApplication sharedApplication] keyWindow];
window.rootViewController = self.viewController;
}

- (void)testSetCard_allFields_whileEditingNumber {
XCTAssertTrue([self.sut.numberField becomeFirstResponder]);
PSTCKCardParams *card = [PSTCKCardParams new];
NSString *number = @"4123450131001381";
NSString *cvc = @"883";
card.number = number;
card.expMonth = 10;
card.expYear = 99;
card.cvc = cvc;
[self.sut setCardParams:card];
NSData *imgData = UIImagePNGRepresentation(self.sut.brandImageView.image);
NSData *expectedImgData = UIImagePNGRepresentation([PSTCKPaymentCardTextField cvcImageForCardBrand:PSTCKCardBrandVisa]);

XCTAssertTrue(self.sut.numberFieldShrunk);
XCTAssertTrue([expectedImgData isEqualToData:imgData]);
XCTAssertEqualObjects(self.sut.numberField.text, number);
XCTAssertEqualObjects(self.sut.expirationField.text, @"10/99");
XCTAssertEqualObjects(self.sut.cvcField.text, cvc);
XCTAssertTrue([self.sut.cvcField isFirstResponder]);
XCTAssertTrue(self.sut.isValid);
}

- (void)testSetCard_partialNumberAndExpiration_whileEditingExpiration {
XCTAssertTrue([self.sut.expirationField becomeFirstResponder]);
PSTCKCardParams *card = [PSTCKCardParams new];
NSString *number = @"41";
card.number = number;
card.expMonth = 10;
card.expYear = 99;
[self.sut setCardParams:card];
NSData *imgData = UIImagePNGRepresentation(self.sut.brandImageView.image);
NSData *expectedImgData = UIImagePNGRepresentation([PSTCKPaymentCardTextField brandImageForCardBrand:PSTCKCardBrandVisa]);

XCTAssertFalse(self.sut.numberFieldShrunk);
XCTAssertTrue([expectedImgData isEqualToData:imgData]);
XCTAssertEqualObjects(self.sut.numberField.text, number);
XCTAssertEqualObjects(self.sut.expirationField.text, @"10/99");
XCTAssertEqual(self.sut.cvcField.text.length, (NSUInteger)0);
XCTAssertTrue([self.sut.expirationField isFirstResponder]);
XCTAssertFalse(self.sut.isValid);
}

- (void)testSetCard_number_whileEditingCVC {
XCTAssertTrue([self.sut.cvcField becomeFirstResponder]);
PSTCKCardParams *card = [PSTCKCardParams new];
NSString *number = @"4123450131001381";
card.number = number;
[self.sut setCardParams:card];
NSData *imgData = UIImagePNGRepresentation(self.sut.brandImageView.image);
NSData *expectedImgData = UIImagePNGRepresentation([PSTCKPaymentCardTextField brandImageForCardBrand:PSTCKCardBrandVisa]);

XCTAssertTrue(self.sut.numberFieldShrunk);
XCTAssertTrue([expectedImgData isEqualToData:imgData]);
XCTAssertEqualObjects(self.sut.numberField.text, number);
XCTAssertEqual(self.sut.expirationField.text.length, (NSUInteger)0);
XCTAssertEqual(self.sut.cvcField.text.length, (NSUInteger)0);
XCTAssertTrue([self.sut.expirationField isFirstResponder]);
XCTAssertFalse(self.sut.isValid);
}

- (void)testSetCard_empty_whileEditingNumber {
XCTAssertTrue([self.sut.numberField becomeFirstResponder]);
self.sut.numberField.text = @"4123450131001381";
self.sut.cvcField.text = @"883";
self.sut.expirationField.text = @"10/99";
PSTCKCardParams *card = [PSTCKCardParams new];
[self.sut setCardParams:card];
NSData *imgData = UIImagePNGRepresentation(self.sut.brandImageView.image);
NSData *expectedImgData = UIImagePNGRepresentation([PSTCKPaymentCardTextField brandImageForCardBrand:PSTCKCardBrandUnknown]);

XCTAssertFalse(self.sut.numberFieldShrunk);
XCTAssertTrue([expectedImgData isEqualToData:imgData]);
XCTAssertEqual(self.sut.numberField.text.length, (NSUInteger)0);
XCTAssertEqual(self.sut.expirationField.text.length, (NSUInteger)0);
XCTAssertEqual(self.sut.cvcField.text.length, (NSUInteger)0);
XCTAssertTrue([self.sut.numberField isFirstResponder]);
XCTAssertFalse(self.sut.isValid);
}

@end
@@ -0,0 +1,4 @@
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//

0 comments on commit 81bdd72

Please sign in to comment.